extends NodeState


var player: Player:
	get:
		return state_matchine.root as Player


func _on_enter(_data: NodeStateData) -> void:
	player.animation_player.play(Player.ANIMATION_MOVE)


func _on_exit() -> void:
	pass


func _on_process(delta : float) -> void:
	if not player.input_manager.is_move_pressed():
		transition_state(Player.STATE_IDLE)
		return
	if player.input_manager.is_dash_pressed() and player.can_dash():
		transition_state(Player.STATE_DASH)
		return

	player.change_position(player.input_manager.movment_direction * delta * player.stats.speed)
	player.flip_sprite()
